/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.airties.atof.client;

import com.airties.atof.utils.PolledInputStream;


/**
 *
 * @author nurhat
 */
public class ClientMain extends Thread
{

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args)
    {

        System.out.println("Starting client....");
        AtofApplicationContext.initializeForClient();
        System.out.println("Press  X to exit....");
        PolledInputStream reader = new PolledInputStream(System.in,
                                                         1000);
        try {
            while (true) {

                try {
                    Thread.sleep(2000);
                    char readed = (char) reader.read();
                    if (readed == 'X' || readed == 'x') {
                        AtofApplicationContext.close();
                        System.exit(0);
                    }
                    else if ((int) readed != 10) {
                        System.out.println("Press  X to exit....");
                    }
                } catch (Exception ex) {
                }

            }
        } catch (Exception ex) {
        }
    }
}
